<?php

namespace app\admin\controller;

use app\admin\model\VipModel;
use think\Controller;
use think\Db;
use think\Request;

class VipController extends Controller
{
    public function viplist()
    {
        $data = model('VipModel') ->getvip();
        return view('vip/viplist',[
            'data' => $data
        ]);
    }

    public function show($id)
    {
        // var_dump($id);die;
        $data = model('VipModel') ->getshow($id);
        return view('vip/vipdetails',[
            'data' => $data
        ]);
    }

    public function levelcont()
    {
        $data = model('VipModel') ->getlevel();
        return view('vip/level',[
            'data' => $data
        ]);
    }

    public function leveladd()
    {
        return view('vip/leveladd');
    }

    public function leveledit($id)
    {
        $data = model('VipModel') ->leveledit($id);
        return view('vip/leveledit',[
            'data' => $data
        ]);
    }

    public function insertvip()
    {
        $data = model('VipModel') ->insertvip();
        if($data > 0){
            return $this ->success('添加成功','VipController/levelcont');
        }else{
            return $this ->error('添加失败,请重试');
        }
    }

    public function updatelevel()
    {
        $data = model('VipModel') ->updatelevel();
        if($data){
            return $this->success('编辑成功','VipController/levelcont');
        }else{
            return $this->error('编辑失败');
        }
    }
}




















